package com.xuezhixin.example.web.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xuezhixin.example.web.model.ClassMate;
import com.xuezhixin.example.web.service.ClassMateService;

@Controller
@RequestMapping("/classMate")
public class classMateController {

	
	@Resource(name="ClassMateServiceImpl")
	ClassMateService classMateService;
	
	
	
	@RequestMapping("/list")
	public String list(Model model,ClassMate classMate){
		// service
		classMate.setUserName("kf");
		// dao 层 拿到数据
		
		model.addAttribute("classMate", classMate);
		return "/classMate_list";
	}
	
	
	@RequestMapping("/listAll")
	public String listAll(Model model,ClassMate classMate){
		
		List<ClassMate> classMateList= classMateService.selectList();
		model.addAttribute("classMateList", classMateList);
		
		return "/classMate_listAll";
	}
	
	@RequestMapping("/listAll2")
	public String listAl2l(Model model,ClassMate classMate){
		
		List<ClassMate> classMateList= classMateService.selectList();
		model.addAttribute("classMateList", classMateList);
		
		return "/classMate_listAll";
	}
	
	@RequestMapping("/listDB")
	public String listDB(Model model,ClassMate classMate){
		
		List<ClassMate> classMateList=classMateService.selectListDB();
		model.addAttribute("classMateList", classMateList);
		return "/classMate_listDB";
		
	}
	
}
